package com.mz.ozy.adapter;

import android.content.Context;
import android.view.LayoutInflater;
import android.view.View;
import android.view.ViewGroup;
import android.widget.TextView;

import com.mz.ozy.R;
import com.mz.ozy.bean.TbRecrodBean;

import java.util.List;

import androidx.annotation.NonNull;
import androidx.recyclerview.widget.RecyclerView;
import butterknife.BindView;
import butterknife.ButterKnife;

public class TCoinsRecordAdapter extends RecyclerView.Adapter<TCoinsRecordAdapter.MyViewHolder> {


    private Context mContext;

    List<TbRecrodBean.PageBean.PageItemsBean> mBeanList;

    public TCoinsRecordAdapter(Context context, List<TbRecrodBean.PageBean.PageItemsBean> mBeanList) {
        this.mContext = context;
        this.mBeanList = mBeanList;

    }

    @Override
    public MyViewHolder onCreateViewHolder(ViewGroup parent, int viewType) {
        return new MyViewHolder(LayoutInflater.from(mContext).inflate(R.layout.item_tcoins_record, parent, false));
    }

    @Override
    public void onBindViewHolder(@NonNull MyViewHolder holder, int position) {

        /*:"b(申请结算金额),c(手续费),d(到账金额),e(提币时间),m(0-待审核,1-已审核 2-待审核，3-成功,4提现失败，5-提现失败),l(提币地址)",*/
        TbRecrodBean.PageBean.PageItemsBean bean = mBeanList.get(position);
        holder.tvCoinCode.setText("提现" + bean.getAmt());
        holder.mTvTbNumber.setText("实际到账" + bean.getDzamt());

        holder.mDateTv.setText(bean.getInitdate());
        int status1 = bean.getShstate();

        if (status1 == 0) {
            holder.mTvSjMoney.setText("审核中");


        } else if (status1 == 1) {
            holder.mTvSjMoney.setText("提现成功");

        } else {
            holder.mTvSjMoney.setText("提现失败");
        }
     /*   if (status == 0 || status == 1 || status == 2) {
            holder.mTvStatus.setText(R.string.tb_status_type_0);
            holder.mTvStatus.setTextColor(mContext.getResources().getColor(R.color.c_519bff));

        } else if (status == 3) {
            holder.mTvStatus.setText(R.string.tb_status_type_1);
            holder.mTvStatus.setTextColor(mContext.getResources().getColor(R.color.c_519bff));

        } else if (status == 4 || status == 5) {
            holder.mTvStatus.setText(R.string.tb_status_type_2);
            holder.mTvStatus.setTextColor(mContext.getResources().getColor(R.color.c_8F969E));
        }*/
        holder.mTvAddress.setText("提币地址：" + bean.getL());

    }

    @Override
    public int getItemCount() {
        return mBeanList.size();
    }


    static class MyViewHolder extends RecyclerView.ViewHolder {
        @BindView(R.id.tv_coinCode)
        TextView tvCoinCode;
        @BindView(R.id.tv_tb_number)
        TextView mTvTbNumber;
        @BindView(R.id.dateTv)
        TextView mDateTv;
        @BindView(R.id.tv_sj_money)
        TextView mTvSjMoney;
        @BindView(R.id.tv_status)
        TextView mTvStatus;
        @BindView(R.id.tv_address)
        TextView mTvAddress;

        public MyViewHolder(View itemView) {
            super(itemView);
            ButterKnife.bind(this, itemView);
        }
    }


}
